<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<link rel="stylesheet" href="http://code.jquery.com/ui/1.9.2/themes/base/jquery-ui.css" />
 <script src="http://code.jquery.com/jquery-1.8.3.js"></script>
 <script src="http://code.jquery.com/ui/1.9.2/jquery-ui.js"></script>
 <script src="scripts/NumericOnly.js"></script>
 <script src="scripts/NoKeyDown.js"></script>
 <script type="text/javascript" src="jquery.validate.min.js"></script>
<script>
	$(function() {
		$("#startDate").datepicker({
			minDate : "Now",
			changeMonth : true,
			numberOfMonths : 1,
			dateFormat : 'yy-mm-dd',
			onClose: function( selectedDate ) {
                $( "#endDate" ).datepicker( "option","minDate", selectedDate );
            }
		});

		$("#endDate").datepicker({
			defaultDate : "selectedDate",
			changeMonth : true,
			numberOfMonths : 1,
			dateFormat : 'yy-mm-dd',
			onClose: function( selectedDate ) {
                $( "#startDate" ).datepicker( selectedDate+1);
            }
		});
	});
</script>
<fmt:setBundle basename="message" />
<c:set var="t" value="true"/>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title><fmt:message key="showbooking.title"/></title>
</head>
<body>
<form action="ProcessBooking" method=post>
<center>
<h3><fmt:message key="label.booking.bookingid"/> &#32 ${requestScope.id}</h3>
<input type="hidden" name="bookingId" value=${param['id']} />
<table cellpadding=4 cellspacing=2 border=0>
<tr>
<td><fmt:message key="label.booking.userId"/>
</td>
<td>
<input type="text" name="userId" value="${sessionScope.user.username}" size=15 maxlength=20 readonly="readonly"/>
</td>
<td><fmt:message key="label.booking.contactDetail"/>
</td>
<td><input type="text" name="contactDetail" value="${requestScope.contactDetail}" class="numeric_field" size=15 maxlength=20/>
</td>
</tr>
<tr>
<td><fmt:message key="label.booking.facilityName"/>
</td>
<td>
<c:set var="room001" value="room_001"/>
<select name="facilityName" style="width:125px">
<c:forEach var="facility" items="${requestScope.facilities}">
<c:choose>
<c:when test="${facility.name==requestScope.facilityName}">
<option value="${requestScope.facilityName}" selected>${requestScope.facilityName}</option>
</c:when>
<c:when test="${facility.name!=requestScope.facilityName && facility.name==room_001}">
<option value="${facility.name}" selected>${facility.name}</option>
</c:when>
<c:when test="${facility.name!=requestScope.facilityName && facility.name!=room_001}">
<option value="${facility.name}">${facility.name}</option>
</c:when>
</c:choose>
</c:forEach>
</select>
</td>
<td><fmt:message key="label.booking.priority"/>
</td>
<td>
<c:set var="high" value="high"/>
<select name="priority" style="width:125px">
<c:forEach var="priority" items="${requestScope.priorities}">
<c:choose>
<c:when test="${priority.code==requestScope.priority}">
<option value="${priority.code}" selected>${priority.level}</option>
</c:when>
<c:when test="${priority.code!=requestScope.priority && priority.level==low}">
<option value="${priority.code}" selected>${priority.level}</option>
</c:when>
<c:when test="${priority.code!=requestScope.priority && priority.level!=low}">
<option value="${priority.code}">${priority.level}</option>
</c:when>
</c:choose>
</c:forEach>
</select>
</td>
</tr>
<tr>
<td><fmt:message key="label.booking.startDate"/>
</td>
<td><input type="text" id="startDate" name="startDate" value="${requestScope.startDate}" size=15 maxlength=20 class="blank_field"/>
</td>
<td><fmt:message key="label.booking.endDate"/>
</td>
<td><input type="text" id="endDate" name="endDate" value="${requestScope.endDate}" size=15 maxlength=20 class="blank_field"/>
</tr>
<tr>
<td><fmt:message key="label.booking.reason"/>
</td>
<td>
<!-- <input type="hidden" name="emergency" value="false" />  -->
<c:choose>
<c:when test="${requestScope.emergency==true}">
Emergency<input type="checkbox" name="emergency" value="true" checked/>
</c:when>
<c:when test="${requestScope.emergency!=true}">
Emergency<input type="checkbox" name="emergency" value="true"/>
</c:when>
</c:choose>
</td>
</tr>
</table>
<textarea cols=40 rows=5 name="reason">
	${requestScope.reason}
</textarea>

<c:set var="status" value="${requestScope.status}"/>
<input type="hidden" name="status" value="${status}"/>

<c:if test="${requestScope.insert == t}">
<input type="hidden" name="ins" value="true" />
</c:if>
<c:if test="${requestScope.update == t}">
<input type="hidden" name="ins" value="false" />
</c:if>

<input type="submit" value="Submit"> <input type="reset"  value="Reset">
</center>
</form>
</body>
</html>